# 当用户输入exit推出
while True:
    instr = input("请输入要转换的温度（23C, 89F）：")

    temp = instr.lower().strip()

    if temp == "exit":
        break
    elif temp.endswith('c'):
        c = eval(temp[:-1])
        f = c * 1.8 + 32
        print(f, "F")
    elif temp.endswith('f'):
        f = eval(temp[:-1])
        c = (f - 32) / 1.8
        print(c, "C")
    else:
        print("输入错误")

print("休息一下")